<?php
echo "test";
if (isset($_POST['submit'])) {
<<<<<<< .mine
    if ($_POST['submit'] == "Add")
    addFavourites($_POST['fav_name'],$_POST['fav_url'],$_POST['fav_cat'],$_POST['fav_date']);
    
     

    if ($_POST['submit'] == "Del")
        delFavourites($_POST['fav_id']);
=======
  if ($_POST['submit'] == "Add") {
    if (isDateValid($_POST['fav_date'])) {
      addFavourites($_POST['fav_name'],
              $_POST['fav_url'],
              $_POST['fav_cat'],
              $_POST['fav_date']);
    }
  }
  if ($_POST['submit'] == "Del")
    delFavourites($_POST['fav_id']);
>>>>>>> .r36
}

$cat_lines = readData($cat_data);
?>

<table id="default_table">
  <tr>
    <th>Name</th>
    <th>URL</th>
    <th>Category</th>
    <th>Date</th>
    <th>&nbsp;</th>
  </tr>
  <?php
  $lines = readData($fav_data);

  foreach ($lines as $line) {
    list($fav_id, $fav_name, $fav_url, $fav_cat, $fav_date) = explode("|", $line);
    if ($i2 % 2 > 0) {
      echo '<tr id="row_even">';
    } else {
      echo '<tr id="row_odd">';
    }
    $i2++;
  ?>

    <td><?php echo $fav_name; ?></td>
    <td><a href="<?php echo $fav_url; ?>"><?php echo $fav_url; ?></a></td>
    <td><?php echo $fav_cat; ?></td>
    <td><?php echo $fav_date; ?></td>
    <td><form action="<?php echo $_SERVER['PHP_SELF']; ?>" method="post">
        <input type="hidden" name="fav_id" value="<?php echo $fav_id; ?>" />
        <input type="submit" value="Del" name="submit"/></form>
    </td>
  </tr>
<?php } ?>

  <tr><form action="<?php echo $_SERVER['PHP_SELF']; ?>" method="post">
    <td><input type="text" name="fav_name" /></td>
    <td><input type="text" name="fav_url" /></td>
    <td><select name="fav_cat">
      <?php
      foreach ($cat_lines as $cat_line) {
        list(, $cat_name) = explode("|", $cat_line);
        echo "<option>$cat_name</option>\n";
      }
      ?>
    </select></td>
  <td><input type="text" name="fav_date" value="<?php echo date("Y-m-d"); ?>" /></td>
  <td><input type="submit" value="Add" name="submit" /></td>
</form></tr>
</table>
